import Ember from 'ember';
import BaseBusiness from '../base-business';
const {consultStatus5,consultStatus6,consultStatus7} = Constants;

export default BaseBusiness.extend({
  queryParams: {
      customerId: {
          refreshModel: true
      },
      editMode: {
          refreshModel: true
      },
  },
  header_title:'修改退住登记',
  model(){
    return{};
  },
  setupController(controller, model){
    this._super(controller, model);
    var editMode = controller.get('editMode');
    var id = controller.get('customerId');
    if(editMode=='edit'){
      controller.set('lookDetail',false);
      controller.set('detailEdit',false);
      this.store.findRecord('customerbusinessflow',id).then(function(customerflow){
        controller.set('customerflow',customerflow);
        console.log("customerflow11111111",customerflow);
      });
    }else if(editMode=='look'){
      controller.set('detailEdit',false);
      controller.set('lookDetail',true);
      this.store.findRecord('customerbusinessflow',id).then(function(customerflow){
        controller.set('customerflow',customerflow);
        console.log("customerflow11111111",customerflow);
      });
    }
    else{
      controller.set('lookDetail',false);
      controller.set('detailEdit',true);
      controller.set('customerflow',this.store.createRecord('customerbusinessflow',{}));
    }
    this.store.query('user',{}).then(function(userList){
      controller.set('userList',userList);//登记人  护工
      console.log("userList11111111",userList);
    });

    this.store.query('customerbusinessflow',{filter:{status:{typecode:Constants.consultStatus5}}}).then(function(customerflowList){
      // var customerList = new Ember.A();
      // customerflowList.forEach(function(item){
      //   customerList.pushObject(item.get("customer"));
      // });
      controller.set('customerList',customerflowList);//入住 老人
      console.log("customerList11111111",customerflowList);
    });


  }
});
